package com.liang.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.liang.pojo.User;
import com.liang.service.UserService;

@RestController
public class JsController {
	@Autowired
	@Qualifier("userServiceImpl")
	private UserService userService;
	@RequestMapping("/jsUsername")
	public void selectUserByUsername(String username,HttpServletResponse response) throws IOException {
		User user = userService.selectUserByUsername(username);
		if(user!=null) {
			response.getWriter().print("yes");
		}else {
			response.getWriter().print("no");
		}
	}
}
